# -*-coding:utf-8 -*-

from org.models import *
from rest_framework import serializers
from core.api.serializers import DynamicFieldsSerializerMixin


class DepartmentSerializer(DynamicFieldsSerializerMixin, serializers.ModelSerializer):
    member_count = serializers.IntegerField(source='get_member_count', read_only=True)

    class Meta:
        model = Department
        fields = '__all__'


class PersonnelSerializer(DynamicFieldsSerializerMixin, serializers.ModelSerializer):
    __str__ = serializers.CharField(read_only=True)
    department_name = serializers.URLField(source='get_department_name', read_only=True)
    thumbnail = serializers.URLField(source='get_thumbnai100x100', read_only=True)

    class Meta:
        model = Person
        fields = '__all__'
